// pages/myself/myself.js
Page({

  data: {
    phoneNumber:'17854116729',
    my_state_item: [{ img: '../../img/state1.png', name: '待付款', url: ''},
      { img: '../../img/state2.png', name: '代发货', url: ''},
      { img: '../../img/state3.png', name: '待收货', url: ''},
      { img: '../../img/state4.png', name: '待评价', url: ''},
      { img: '../../img/state5.png', name: '退款', url: ''},],
    my_service_item: [{ img: '../../img/service1.png', name: '常买清单', url:'../mettingPlace/mettingPlace'},
      { img: '../../img/service2.png', name: '优惠券', url: '../mettingPlace/mettingPlace'},
      { img: '../../img/service3.png', name: '收货地址', url: '../mettingPlace/mettingPlace'},
      { img: '../../img/service4.png', name: '我的评价', url: '../mettingPlace/mettingPlace'},
      { img: '../../img/service5.png', name: '账户余额', url: '../mettingPlace/mettingPlace'},
      { img: '../../img/service6.png', name: '帮助中心', url: '../mettingPlace/mettingPlace'},
      { img: '../../img/service7.png', name: '意见反馈', url: '../mettingPlace/mettingPlace'},
      { img: '../../img/phone.png', name: '联系客服', url: '../mettingPlace/mettingPlace'}]
  },
  my_state_item:function (e){
    let id = e.currentTarget.dataset.id;
    let url = this.__data__.my_service_item[id].url;
    wx.redirectTo({
      url: url,
    })
  },
  my_service_item:function (e){
    let id = e.currentTarget.dataset.id;
    let url = this.__data__.my_service_item[id].url;
    if (id != 7) {
      wx.redirectTo({
        url: url,
      })
    } else {
      wx.makePhoneCall({
        phoneNumber: this.__data__.phoneNumber,
        success: function () {
          console.log("拨打电话成功！")
        },
        fail: function () {
          console.log("拨打电话失败！")
        }
      })
    }
  },
})